package com.powernode.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.powernode.domain.Sku;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 内容:
 * 作者: cy
 */
@Mapper
public interface SkuMapper extends BaseMapper<Sku> {
    @Update("update sku set stocks = stocks + #{count} where sku_id = #{skuId} and stocks + #{count} >=0")
    int changeSkuStock(@Param("skuId") Long skuId, @Param("count") Integer count);
}